package com.itboye.pondteam.responsitory;

import android.content.Context;
import android.telephony.TelephonyManager;

import com.google.gson.reflect.TypeToken;
import com.itboye.pondteam.app.MyApplication;
import com.itboye.pondteam.bean.DeviceDetailModel;
import com.itboye.pondteam.bean.DeviceListBean;
import com.itboye.pondteam.bean.PersonDataBean;
import com.itboye.pondteam.bean.PondTeamMostNewModel;
import com.itboye.pondteam.interfaces.IUserInfoInterface;
import com.itboye.pondteam.volley.BaseErrorListener;
import com.itboye.pondteam.volley.BaseNetRepository;
import com.itboye.pondteam.volley.BaseSuccessReqListener;
import com.itboye.pondteam.volley.ByJsonRequest;
import com.itboye.pondteam.volley.ICompleteListener;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;


/**
 * Created by admin on 2016/11/28.
 */

public class UserResponsitory extends BaseNetRepository implements
        IUserInfoInterface<PersonDataBean> {
    String api = "103";//接口版本号
    String loginTypeKey = "By_User_login";// 用户登录
    String registerByEmail = "By_User_registerByEmail";//用户注册(通过邮箱)
    private String sendVertificationCode = "By_SecurityCode_send";//发送验证码
    private String yanzhengVertificationCode = "By_SecurityCode_verify";//验证验证码
    private String updatePass = "By_User_updatePwdByEmail";//用户修改密码
    private String updateXinxi = "By_User_update";//修改个人信息
    private String modify_pass = "By_User_updatePwdByOldPwd";//用户修改密码（通过旧密码）
    private String address_pass = "By_Address_add";//添加收货地址
    private String address_query = "By_Address_query";//查询收货地址
    private String delete_address = "By_Address_delete";//删除收货地址
    private String update_address = "By_Address_update";//更新收货地址
    private String renzheng = "By_Worker_apply";//司机认证
    private String jigongRenZheng = "By_Worker_setSkill";//技工认证
    private String weizhiUpdate = "By_User_updateLatLng";//地理位置更新

    private String configApp = "By_Config_app";//获取全局配置
    private String allAll = "By_ShoppingCart_bulkAdd";//批量添加购物车
    private String moren_address = "By_Address_getDefault";//获取默认收货地址
    private String getUserDeviceInfo = "By_SunsunFilterVat_userDeviceInfo";//过滤桶获取设备信息
    private String getDeviceStatus = "By_SunsunFilterVat_deviceInfo";//过滤桶获取设备信息
    private String bindDevice = "By_SunsunFilterVat_bindUid";//绑定设备
    private String devidceList = "By_SunsunUserDevice_query";//设备列表
    private String devidceSet = "By_SunsunFilterVat_devicesCtrl";//设备设置
    private String addDevice = "By_SunsunUserDevice_add";//设备设置


    private String devidceDelete = "By_SunsunUserDevice_del";//设备删除
    private String deviceUpdate = "By_SunsunUserDevice_change";//设备修改
    private String getMostNewPondDevice = "By_SunsunFilterVat_queryLatest";//获取最新的过滤桶版本
    private String beginUpdatePondTeam = "By_SunsunFilterVat_updateFirmware";//开始更新过滤桶
    private String sendEmailCode = "By_SecurityCode_sendEmail";//发送邮箱验证码接口
    private String feedBack = "By_Suggest_add";//用户反馈
    private String authDevicePwd_pondteam = "By_SunsunFilterVat_auth";//验证设备
    private String authDevicePwd_HeatingRod = "By_SunsunHeatingRod_auth";//验证设备
    private String authDevicePwd_aq806 = "By_SunsunAq806_auth";//验证设备

    public UserResponsitory(ICompleteListener iCompleteListener) {
        super(iCompleteListener);
    }

    @Override
    public void login(String username, String pwd) {
        Type type = new TypeToken<PersonDataBean>() {
        }.getType();
        String apiVer = api;
        Map<String, Object> map = new HashMap<>();
        map.put("username", username);
        map.put("password", pwd);
        map.put("device_type", "android");
        map.put("country", "+86");
//        map.put("role","role_skilled_worker");
        map.put("device_token", getDeviceToken());
        (new ByJsonRequest.Builder<PersonDataBean>())
                .setTypeVerParamsAndReturnClass(loginTypeKey, "104", map, type)
                .requestListener(
                        new BaseSuccessReqListener<PersonDataBean>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }


    @Override
    public void registerByEmail(String nickname, String contact, String address, String email, String password) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "101";
        Map<String, Object> map = new HashMap<>();
        map.put("nickname", nickname);
        map.put("contact", contact);
        map.put("address", address);
        map.put("email", email);
        map.put("password", password);
        map.put("from", "0");
        map.put("code", "itboye");
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(registerByEmail, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    /**
     * 发送验证码
     *
     * @param country   +86
     * @param mobile
     * @param code_type
     */
    @Override
    public void sendVerificationCode(String country, String mobile, String code_type) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "101";
        Map<String, Object> map = new HashMap<>();
        map.put("country", country);
        map.put("mobile", mobile);
        map.put("code_type", code_type);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(sendVertificationCode, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    /**
     * 验证验证码
     *
     * @param country
     * @param mobile
     * @param code
     * @param code_type
     */
    @Override
    public void YanZhengverificationCode(String country, String mobile, String code, String code_type) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "101";
        Map<String, Object> map = new HashMap<>();
        map.put("country", country);
        map.put("mobile", mobile);
        map.put("code", code);
        map.put("code_type", code_type);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(yanzhengVertificationCode, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }


    /**
     * 修改密码
     *
     * @param sid
     * @param code     验证码[必须](itboye是万能验证码，测试其它请调用验证码接口获取)
     * @param mobile   邮箱
     * @param password 新密码[必须]（6-32位）
     */
    @Override
    public void updatePass(String sid, String code, String mobile, String password) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "101";
        Map<String, Object> map = new HashMap<>();
        map.put("s_id", "itboye");
        map.put("code", "itboye");
        map.put("email", mobile);
        map.put("password", password);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(updatePass, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    /**
     * 修改个人信息
     *
     * @param uid
     * @param types   (nickname:昵称;  sex:性别(0,1); sign:个性签名; email:邮箱； weixin：微信； company：公司； job_title：岗位；loc_country：所在国家编码； loc_area：地区)
     * @param content
     */
    @Override
    public void upadtaInformation(String uid, String types, String content) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        map.put(types, content);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(updateXinxi, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    /**
     * 修改密码（通过旧密码）
     *
     * @param uid
     * @param password
     * @param new_password
     */
    @Override
    public void modifyPass(String uid, String password, String new_password) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        map.put("password", password);
        map.put("new_password", new_password);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(modify_pass, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void addressAdd(String s_id, String uid, String contactname, String mobile, String postal_code, String province, String city, String area, String detailinfo, String defaults, String country, String country_id) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "102";
        Map<String, Object> map = new HashMap<>();
        map.put("s_id", s_id);
        map.put("uid", uid);
        map.put("contactname", contactname);
        map.put("mobile", mobile);
        map.put("postal_code", postal_code);
        map.put("province", province);
        map.put("city", city);
        map.put("area", area);
        map.put("detailinfo", detailinfo);
        map.put("default", defaults);
        map.put("country", country);
        map.put("country_id", country_id);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(address_pass, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    /**
     * 更新收货地址
     *
     * @param id
     * @param uid
     * @param contactname
     * @param mobile
     * @param postal_code
     * @param province
     * @param city
     * @param area
     * @param detailinfo
     * @param defaults
     * @param country
     * @param country_id
     */
    @Override
    public void updateAddress(String s_id, String id, String uid, String contactname, String mobile, String postal_code, String province, String city, String area, String detailinfo, String defaults, String country, String country_id) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "101";
        Map<String, Object> map = new HashMap<>();
        map.put("s_id", s_id);
        map.put("id", id);
        map.put("uid", uid);
        map.put("contactname", contactname);
        map.put("mobile", mobile);
        map.put("postal_code", postal_code);
        map.put("province", province);
        map.put("city", city);
        map.put("area", area);
        map.put("detailinfo", detailinfo);
        map.put("default", defaults);
        map.put("country", country);
        map.put("country_id", country_id);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(update_address, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void sijiRenZheng(String uid, String id_number, String realname, String id_certs) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        map.put("id_number", id_number);
        map.put("realname", realname);
        map.put("id_certs", id_certs);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(renzheng, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void jigongRenZheng(String uid, String skills) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        map.put("skill_ids", skills);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(jigongRenZheng, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void weiZhiUpdate(String id, String lat, String lng, String s_id) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("lat", lat);
        map.put("lng", lng);
        map.put("s_id", s_id);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(weizhiUpdate, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void getConfigApp() {
//        Type type = new TypeToken<ConfigBean>() {
//        }.getType();
//        String apiVer = "100";
//        Map<String, Object> map = new HashMap<>();
//        (new ByJsonRequest.Builder<ConfigBean>())
//                .setTypeVerParamsAndReturnClass(configApp, apiVer, map, type)
//                .requestListener(
//                        new BaseSuccessReqListener<ConfigBean>(
//                                getListener()))
//                .errorListener(new BaseErrorListener(getListener()))
//                .desEncodeThenBuildAndSend();
    }

    String updatePwdByPwd = "By_User_updatePwdByOldPwd";//通过旧密码修改密码

    @Override
    public void updatePwdByPwd(String uid, String oldPass, String newPass) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";

        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        map.put("password", oldPass);
        map.put("new_password", newPass);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(updatePwdByPwd, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void getDeviceDetailInfo(String did, String uid, String psw) {
        Type type = new TypeToken<DeviceDetailModel>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        map.put("uid", uid);
//        map.put("ctrl_pwd", psw);
        (new ByJsonRequest.Builder<DeviceDetailModel>())
                .setTypeVerParamsAndReturnClass(getUserDeviceInfo, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<DeviceDetailModel>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void bindDevice(String did, String uid) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";

        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        map.put("uid", uid);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(bindDevice, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void getMyDeviceList(String uid) {
        Type type = new TypeToken<ArrayList<DeviceListBean>>() {
        }.getType();
        String apiVer = "100";

        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        (new ByJsonRequest.Builder<ArrayList<DeviceListBean>>())
                .setTypeVerParamsAndReturnClass(devidceList, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<ArrayList<DeviceListBean>>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void deviceSet(String did, String clEn, int clWeek, String clTm, String clDur, String clState, String clCfg, String uvOn, String uvOff, String uvWH, String uvCfg, int out_state_a, int out_state_b) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "101";
        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        if (!clEn.equals("")) {
            map.put("cl_en", clEn);
        }
        if (clWeek != -1) {
            map.put("cl_week", clWeek);
        }
        if (!clTm.equals("")) {
            map.put("cl_tm", clTm);
        }
        if (!clDur.equals("")) {
            map.put("cl_dur", clDur);
        }
        if (!clState.equals("")) {
            map.put("cl_state", clState);
        }
        if (!clCfg.equals("")) {
            map.put("cl_cfg", clCfg);
        }
        if (!uvOn.equals("")) {
            map.put("uv_on", uvOn);
        }
        if (!uvOff.equals("")) {
            map.put("uv_off", uvOff);
        }
        if (!uvWH.equals("")) {
            map.put("uv_wh", uvWH);
        }
        if (!uvCfg.equals("")) {
            map.put("uv_cfg", uvCfg);
        }
        if (out_state_a != -1) {
            map.put("out_state_a", out_state_a);
        }
        if (out_state_b != -1) {
            map.put("out_state_b", out_state_b);
        }

        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(devidceSet, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void addDevice(String uid, String did, String device_nickname) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        map.put("uid", uid);
        map.put("device_nickname", device_nickname);
        TimeZone tz = TimeZone.getDefault();
        String s =tz.getDisplayName(false, TimeZone.SHORT);
        s=s.substring(s.indexOf(":")-1,s.indexOf(":"));
        map.put("timezone", s);
        map.put("lang", "zh-cn");
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(addDevice, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void deleteDevice(String id) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(devidceDelete, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void updateDeviceName(String id, String nickName, String chazuoA, String chazuoB) {

        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "102";
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("device_nickname", nickName);
        map.put("nickname_a", chazuoA);
        map.put("nickname_b", chazuoB);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(deviceUpdate, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void getMostNewPondDevice(String did) {
        Type type = new TypeToken<PondTeamMostNewModel>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        (new ByJsonRequest.Builder<PondTeamMostNewModel>())
                .setTypeVerParamsAndReturnClass(getMostNewPondDevice, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<PondTeamMostNewModel>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void beginUpdatePondTeam(String did) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(beginUpdatePondTeam, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void getDeviceStatus(String did) {
        Type type = new TypeToken<DeviceDetailModel>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        (new ByJsonRequest.Builder<DeviceDetailModel>())
                .setTypeVerParamsAndReturnClass(getDeviceStatus, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<DeviceDetailModel>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void sendEmailCode(String customText, String s) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "101";
        Map<String, Object> map = new HashMap<>();
        map.put("email", customText);
        map.put("code_type", s);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(sendEmailCode, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void feedback(String deviceType, String name, String email, String tel, String uid, String text) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("device_type", deviceType);
        map.put("name", name);
        map.put("email", email);
        map.put("tel", tel);
        map.put("uid", uid);
        map.put("text", text);
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(feedBack, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    @Override
    public void authDevicePwd(String did, String ctrl_pwd, String deviceType) {
        Type type = new TypeToken<String>() {
        }.getType();
        String apiVer = "100";
        Map<String, Object> map = new HashMap<>();
        map.put("did", did);
        map.put("ctrl_pwd", ctrl_pwd);
        String typekey= authDevicePwd_pondteam;
        if(deviceType.equals("S01")){
            //过滤桶
            typekey= authDevicePwd_pondteam;
        }else if(deviceType.equals("S02")){
            //加热棒
            typekey= authDevicePwd_HeatingRod;
        }else if(deviceType.equals("S03")){
            //806
            typekey= authDevicePwd_aq806;
        }
        (new ByJsonRequest.Builder<String>())
                .setTypeVerParamsAndReturnClass(typekey, apiVer, map, type)
                .requestListener(
                        new BaseSuccessReqListener<String>(
                                getListener()))
                .errorListener(new BaseErrorListener(getListener()))
                .desEncodeThenBuildAndSend();
    }

    public String getDeviceToken() {
        TelephonyManager tm = (TelephonyManager) MyApplication.getInstance().getSystemService(Context.TELEPHONY_SERVICE);
        String DEVICE_ID = tm.getDeviceId();
        return DEVICE_ID;
    }
}
